/**
 * Scalog - Scalog is a logging framework for the Scala programming language.
 * Copyright (C) 2009  Laurent Grangier
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.scalog.log4j

import net.scalog.standard.StandardLevel
import org.apache.log4j.{Level => Log4JLevel};
import net.scalog.Level

/**
 * Helper for the Log4J integration.
 *
 * @author Laurent Grangier
 */
object Log4JHelper {

  def getLevel(level : Level) : Log4JLevel = {
    level match {
      case StandardLevel.TRACE => Log4JLevel.TRACE
      case StandardLevel.DEBUG => Log4JLevel.DEBUG
      case StandardLevel.INFO => Log4JLevel.INFO
      case StandardLevel.WARN => Log4JLevel.WARN
      case StandardLevel.ERROR => Log4JLevel.ERROR
      case StandardLevel.FATAL => Log4JLevel.FATAL
      case _ => throw new IllegalArgumentException("The scalog level " + level + " cannot be converted to a Log4J level.");
     }
  }
  
}
